package com.example.travelservlet.search.controller;

import com.example.travelservlet.search.service.HotSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author kiki
 * @dtae 2023/4/23 11:10
 */
@RestController
@RequestMapping("/hot")
public class HotSearchController {

    @Autowired
    private HotSearchService hotSearchService;

    @GetMapping("/add/{hotTitle}")
    public void add(@PathVariable String hotTitle) {
        hotSearchService.add(hotTitle);
    }

    @GetMapping("/hotTopFive")
    public List<String> hotTopFive() {
        List<String> list = hotSearchService.hotTopFive();
        return list;
    }
}
